<html>
<head>
<meta charset="UTF-8">
</head>

<?php

	include './header.php';
	include './query.php';

	session_start();
	
	$phone = $_POST['phone'];
	if ($phone) {
		$_POST['posted'] = true;
		$user = array();
		$user['name'] = $_POST['name'];
		$user['phone'] = $phone;
		$user['sex'] = 0;
		$user['birthday'] = $_POST['birthday'];
	
		$ret = new_member($user);
		if ($ret) {
			echo 'ok';
			header('Location: /wine/home.php');
		}
		else {
			$_SESSION['callback'] = '/wine/welcome.php';
			header('Location: /wine/error.php');
		}
	}

?>


<body>
<div class="alert alert-info" role="alert">
        <h1>欢迎注册</h1>
</div>


<form action="" method="post" >
  <div class="form-group">
    <label for="名字">名字</label>
    <input name="name" type="text" class="form-control" id="name" placeholder="名字">
  </div>
  <div class="form-group">
    <label for="电话">电话</label>
    <input name="phone" type="text" class="form-control" id="phone" placeholder="电话">
  </div>
  <div class="form-group">
    <label for="生日">生日</label>
    <input type="text" name="birthday" class="form-control" id="birthday" placeholder="1990-10-10">
  </div>

<div class="radio">
  <label>
    <input type="radio" name="sex" id="optionsRadios1" value="1" checked>
    男
  </label>
</div>
<div class="radio">
  <label>
    <input type="radio" name="sex" id="optionsRadios2" value="0">
    女
  </label>
</div>

  <button type="submit" class="btn btn-primary">注册</button>
</form>

</body>

<script>
</script>

</html>	

